var app = getApp(), api = getApp().api;

Page({
    data: {
        api_host: '',
        is_show: !1,
        statusbar: 0,
        headshow: 0,
        titleH:0
    },
    onLoad: function(t) {
        const res = wx.getSystemInfoSync();
        var statusbarH = res.statusBarHeight;
        const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
        var titleH = (menuButtonInfo.top - statusbarH) * 2 + menuButtonInfo.height;
        this.setData({
        statusbar: statusbarH,
        titleH:titleH
        })
        getApp().page.onLoad(this, t);
        this.setData({
            api_host: getApp().globalData.api_host
        })
        var e = this;
        getApp().core.showLoading({
            title: "加载中"
        }), getApp().request({
            url: getApp().api.mch.user.myshop,
            success: function(t) {
                getApp().core.hideLoading(), 0 == t.code && (0 === t.data.mch.is_open && getApp().core.showModal({
                    title: "提示",
                    content: "\b店铺已被关闭！请联系管理员",
                    showCancel: !1,
                    success: function(t) {
                        t.confirm && getApp().core.navigateBack();
                    }
                }), e.setData(t.data), e.setData({
                    is_show: !0
                })), 1 == t.code && getApp().core.redirectTo({
                    url: "/mch/apply/apply-info"
                });
            }
        });
    },
    onPageScroll: function (e) {
        let opacity = 0
        if (e.scrollTop <= 200) {
          opacity = e.scrollTop / 200
        } else {
          opacity = 1
        }
        this.setData({
          headshow: opacity
        })
    },
    goBack() {
        wx.navigateBack({
          delta: 1
        })
    },
    onReady: function() {
        getApp().page.onReady(this);
    },
    onShow: function() {
        getApp().page.onShow(this);
    },
    onHide: function() {
        getApp().page.onHide(this);
    },
    onUnload: function() {
        getApp().page.onUnload(this);
    },
    navigatorSubmit: function(t) {
        getApp().request({
            url: getApp().api.user.save_form_id + "&form_id=" + t.detail.formId
        }), getApp().core.navigateTo({
            url: t.detail.value.url
        });
    },
    showPcUrl: function() {
        this.setData({
            show_pc_url: !0
        });
    },
    hidePcUrl: function() {
        this.setData({
            show_pc_url: !1
        });
    },
    copyPcUrl: function() {
        var e = this;
        getApp().core.setClipboardData({
            data: e.data.pc_url,
            success: function(t) {
                // e.showToast({
                //     title: "内容已复制"
                // });
            }
        });
    },
    goToIncomeCode: function () {
      getApp().core.navigateTo({
        url: "/pages/income-code/income-code?mch_id=" + this.data.mch.id
      });
    },
    goToKefu: function () {
        wx.navigateTo({
            url: '/kefu/kefu?mch_id=' + this.data.mch.id
        })
    }
});